<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <meta charset="utf-8"/>
    <title>会员管理 - 会员列表</title>
    <?php include($this->c['_homes']['_viewsHome'] . '/_global/_head.php'); ?>
</head>
<!-- BEGIN BODY -->
<body class="page-header-fixed page-sidebar-fixed">
<!-- BEGIN HEADER -->
<?php include($this->c['_homes']['_viewsHome'] . '/_global/head.php'); ?>
<!-- END HEADER -->
<div class="clearfix"></div>
<!-- BEGIN CONTAINER -->
<div class="page-container">
    <!-- BEGIN HORIZONTAL MENU PAGE SIDEBAR1 -->
    <?php include($this->c['_homes']['_viewsHome'] . '/_global/menu.php'); ?>
    <!-- END BEGIN HORIZONTAL MENU PAGE SIDEBAR -->
    <!-- BEGIN PAGE -->
    <div class="page-content">
        <!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
        <div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
             aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                        <h4 class="modal-title">Modal title</h4>
                    </div>
                    <div class="modal-body">
                        Widget settings form goes here
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn blue submit_btn">确定</button>
                        <button type="button" class="btn default" data-dismiss="modal">取消</button>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->
        <!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
        <!-- BEGIN PAGE HEADER-->
        <div class="row">
            <div class="col-md-12">
                <!-- BEGIN PAGE TITLE & BREADCRUMB-->
                <h3 class="page-title"> 会员搜索 </h3>
                <ul class="page-breadcrumb breadcrumb">
                    <li><i class="icon-home"></i> <a href="/manage">后台</a> <i class="icon-angle-right"></i></li>
                    <li> 会员管理 <i class="icon-angle-right"></i></li>
                    <li>会员搜索</li>
                </ul>
                <!-- END PAGE TITLE & BREADCRUMB-->
            </div>
        </div>
        <!-- END PAGE HEADER-->
        <!-- BEGIN PAGE CONTENT-->
        <div class="row"  >
            <div class="col-md-12">
                <div class="portlet box">
                    <div class="booking-search">
                        
                            <div class="row form-group">
                            <div class="col-md-4">
                                <div class="input-cont">
                                    <input class="form-control" name="keyword" placeholder="请输入手机号码/昵称"
                                           id="_keyword" type="text">
                                </div>
                            </div>

                                <div class="col-md-1"><input type="submit" class="btn blue btn-block" value="搜 索"></div>
                            </div>

                        
                    </div>
                </div>
            </div>
        </div>
      <div class="row" id="content">
        <!-- END PAGE CONTENT-->
        </div>
    </div>
    <!-- END PAGE -->
</div>
<!-- END CONTAINER -->
<!-- END CONTAINER -->
<?php include($this->c['_homes']['_viewsHome'] . '/_global/_footer.php'); ?>
<script>
jQuery(document).ready(function() {    
   App.init();   
});
</script>
<script>
$(document).ready(function(){
  $(".btn-block").click(function(){
   $.ajax({
         type: "GET",
         url: "/member/ajax",
         data: {keyword:$("#_keyword").val(), act:"search"},
         dataType: "json",
         success: function(data){
            
             if(data.code==200){
                 if(!data.type){
                    location.href="/member/detail?uid="+data.uid;
                 }else{
                    //alert(data.data.data.length)
                    //alert(JSON.stringify(data.data));
              	        if(data.data.data.length>0){
              	        	
              	        var htmls = '';
             	            htmls += '<div class="col-md-12"><div class="portlet box blue"><div class="portlet-title"><div class="caption"><i class="icon-list"></i>列表</div></div>';
          	   	            htmls += '<div class="portlet-body"><div class="table-scrollable"><table class="table table-striped table-bordered table-hover dataTable">';
          	   	            htmls +=' <thead><tr><th>UID</th><th>手机号码</th><th>会员头像</th><th>会员昵称</th><th>所属门店</th><th>会员级别</th></tr></thead><tbody>';     
              	   		 $.each(data.data.data,function(key,value){
              	   			
              	   	          var img = '/style/assets/img/avatar.png';
              	   	          var level='';
              	   	          if(value.headimgurl >0){
          							img = value.headimgurl; 
                  	   	         }else if(value.wechat_headimgurl !=''){
                   	   	        	img = value.wechat_headimgurl; 
                      	   	      }
                  	   	      if(value.mobile == ""){
                    	   	    	  level = '<span class="label label-default">用户</span>';
                      	   	    }if(value.member_level==0){
                                  level = '<span class="label label-info">游客</span>';
                                }if(value.member_level==1){
                                  level = '<span class="label label-success">会员</span>';
                                }if(value.member_level==2){
                                  level = '<span class="label label-primary">加盟店</span>';
                                }if(value.member_level==3){
                                  level = '<span class="label label-danger">加盟仓</span>';
                                }
              	   	           htmls +='<tr onClick="_detail('+value.uid+')" data-uid="'+value.uid+'"><td>'+value.uid+'</td><td>'+value.mobile+'</td>';
              	   	           htmls +='<td><img src="'+img+'" width="45" height="45" /></td>';
              	   	           htmls +='<td>'+value.realname+'</td><td>'+value.store_id+'</td><td>'+level+'</td></tr>';
              	   	          
              	   		 });
                   	    	htmls +='</tbody></table></div></div></div></div>';
              	   	    	$('#content').html(htmls);
              	        }

                   }
            }else{
                alert("["+data.code+"]"+data.msg)
            }
          }
         });
  });


});
function _detail(id){
	 location.href="/member/detail?uid="+id;
	
}


</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>